/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2018-2021.
 * Description: add hert1380 cfi driver adapation
 * Author: xiaoqian <xiaoqian9@huawei.com>
 * Create: 2018-10-09
 */

#ifndef __MTD_CFI_ENHANCE_DEBUG_H
#define __MTD_CFI_ENHANCE_DEBUG_H
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/byteorder.h>

#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/xip.h>
/* we can write log into kbox regions in the future with set_kbox_region */
#define	cfi_enhance_debug_log(fmt, arg...)	\
	printk("[CFI]"fmt, ## arg)
#define cfi_enhance_soft_reset(chip, map, cfi)	\
cfi_send_gen_cmd(0xF0, 0, chip->start, map, cfi, cfi->device_type, NULL)

#ifdef CONFIG_RTOS_HAL_HERT1380_CFI_SPEC
extern uint cfi_optimize;
#endif

void cfi_enhance_report_state(struct map_info *map, struct flchip *chip);
int __xipram cfi_enhance_erase_good(struct map_info *map, struct flchip *chip,
				    unsigned long addr, int len);
int __xipram cfi_enhance_buffer_write_check(struct map_info *map,
					    struct flchip *chip,
					    unsigned long adr,
					    const u_char *buf, int len);
#endif
